package com.linln.wtp.controller.vehicleScan;

import com.linln.common.vo.JsonResult;
import com.linln.common.vo.PageResult;
import com.linln.component.wtpshiro.annotation.UserLoginToken;
import com.linln.modules.userule.domain.VehicleScanDO;
import com.linln.modules.userule.service.VehicleScanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * 
 * 
 * @author chglee
 * @email 1992lcg@163.com
 * @date 2021-04-10 16:50:51
 */
 
@Controller
@RequestMapping("/vehicleScan")
public class VehicleScanController {
	@Autowired
	private VehicleScanService vehicleScanService;
	
	@UserLoginToken
	@ResponseBody
	@PostMapping("/saveNewCar")
	public JsonResult saveNewCar(VehicleScanDO vehicleScanDO){
		VehicleScanDO vehicleScanDO1 = vehicleScanService.getVehicleScan(vehicleScanDO.getPlate());
		if(vehicleScanDO1 != null || vehicleScanDO1.getPlate()==null){
			return JsonResult.ok();
		}
		//判断是否有这个数据
		if(vehicleScanService.saveVehicleScan(vehicleScanDO)){
			return JsonResult.ok();
		}else {
			return JsonResult.error();
		}
	}

}
